Create separate automodel pack#13879
Conversation
aeisenberg
left a comment
There was a problem hiding this comment.
I think you need to add this pack to the codeql-workspace.yml file in the root of the repo. I'm not sure if that's all that's going on. I can try this out later today.
Great! that fixed VS Code for me 🎉 |
|
Can confirm: no squiggles over here either! Thank you, @aeisenberg <3 |
|
Fantastic. 😄 Are you seeing any other problems? |
There was a problem hiding this comment.
You probably want to add a groups property to this file. Maybe this:
groups:
- java
- automodel
This property controls how and when to run pack commands on slices of workspace packs. This way, when you add automodel packs for other languages, you can publish all of them by using the command codeql pack publish --groups automodel,-test (This will publish all non-test automodel packs.)
So, you will want to add a similar group to the test pack (and add test as one of its groups.
Check out the other packs for inspiration.
There was a problem hiding this comment.
Oh...I see. The tests are included in the same pack. They should probably be split into its own pack. This way you can publish the queries without including the tests.
There was a problem hiding this comment.
You probably want to add a
groupsproperty to this file.
I saw that but couldnt find what it actually did in the documentation. I'll add it.
Oh...I see. The tests are included in the same pack.
Yeah we discussed this, my feeling was that having two separate packs was a bit too much process for such a small pack. But if the standard is to always split then I'll make that change as well.
| echo Bumping versions | ||
| "${CODEQL_DIST}/codeql" pack post-release --groups $GRPS | ||
|
|
||
| echo Automodel packs successfully published. Please commit and push the version changes. |
There was a problem hiding this comment.
If you wanted to be extra fancy, you could commit and push directly from this script.
There was a problem hiding this comment.
Hmm... I kind of like it not committing for me, then there is less that suddenly happens. But we can also tweak this afterwards. It almost seems like there should be a generic publish script we could have for all the separate packs, but I am not sure how frequent these separate packs are?
There was a problem hiding this comment.
If this script is going to be run in CI, then something will have to commit and push the change, but maybe that is a longer term goal.
Eventually, all of our core packs will be publishable separately. But, that won't happen for a while. I still would hope that something like this script would become the default way of publishing.
aeisenberg
left a comment
There was a problem hiding this comment.
Trying this locally. Looks like the qlref files are no longer correct. You need to remove the Telemetry/ path segment.
Also, looks like I need a newer codeql version installed. I'm in a place with slow internet, so downloading and will try again when it's ready.
| WORKSPACE_ROOT="$AUTOMODEL_ROOT/../../../.." | ||
| GRPS="automodel,-test" | ||
|
|
||
| if [ -z "$CODEQL_DIST" ]; then |
There was a problem hiding this comment.
(Optional)...you could also check if gh codeql is available and use that if CODEQL_DIST is unset.
There was a problem hiding this comment.
Lets defer that in case we want to make changes to the solorigate pack as well.
| set -e | ||
|
|
||
| AUTOMODEL_ROOT="$(dirname $0)" | ||
| WORKSPACE_ROOT="$AUTOMODEL_ROOT/../../../.." |
There was a problem hiding this comment.
| WORKSPACE_ROOT="$AUTOMODEL_ROOT/../../../.." | |
| WORKSPACE_ROOT="$(realpath "$AUTOMODEL_ROOT/../../..")" |
There was a problem hiding this comment.
I have always been using readlink -f do you know if realpath is ok on all the places this could be thought to run?
There was a problem hiding this comment.
I'm not sure. I've usually just used realpath in situations like this. If readlnk works, too then that's probably fine.
|
Upgraded to v2.14.1 and most tests are passing now. The Publishing and pre/post release process is working. I published and deleted the pack right after. Don't forget that after you publish, you need to manually change the visibility of that pack from |
| #!/bin/sh | ||
| set -e | ||
|
|
||
| AUTOMODEL_ROOT="$(dirname $0)" |
There was a problem hiding this comment.
I know that the original script has this same line (which I wrote a couple of years ago), but not sure if it's the best. This script is only running successfully from the codeql/java/ql/automodel directory. Running in the repo root is failing for some reason.
There was a problem hiding this comment.
Ah...I think the path in line 5 needs to be normalized. Running from the repo root will make WORKSPACE_ROOT=java/ql/automodel/../../.., but it really needs to be WORKSPACE_ROOT=..
| AUTOMODEL_ROOT="$(dirname $0)" | |
| AUTOMODEL_ROOT="$(realpath "$(dirname $0)")" |
There was a problem hiding this comment.
I have changed this to do:
AUTOMODEL_ROOT="$(readlink -f "$(dirname $0)")"
WORKSPACE_ROOT="$AUTOMODEL_ROOT/../../../.."
Happy to switch to realpath as well if that is better.
There was a problem hiding this comment.
Also updated the solorigate script with this change.
|
Merged in master after merging #13852. Moved the MaD file to the new directory and updated it. |
|
Do you think this is ready to be merged, @aeisenberg? |
aeisenberg
left a comment
There was a problem hiding this comment.
I think this looks good. We can make more changes in the future if we are going to fully automate the script. Nice job!
| set -e | ||
|
|
||
| AUTOMODEL_ROOT="$(dirname $0)" | ||
| WORKSPACE_ROOT="$AUTOMODEL_ROOT/../../../.." |
There was a problem hiding this comment.
I'm not sure. I've usually just used realpath in situations like this. If readlnk works, too then that's probably fine.
| echo Bumping versions | ||
| "${CODEQL_DIST}/codeql" pack post-release --groups $GRPS | ||
|
|
||
| echo Automodel packs successfully published. Please commit and push the version changes. |
There was a problem hiding this comment.
If this script is going to be run in CI, then something will have to commit and push the change, but maybe that is a longer term goal.
Eventually, all of our core packs will be publishable separately. But, that won't happen for a while. I still would hope that something like this script would become the default way of publishing.
|
There were some conflicts with #13886 but command-line git resolved them directly. |
|
When trying to publish the automodel pack I ran into a single test failure: @kaeluka does that also happen for you, and do you have any thoughts on why that would happen? I tried to reproduce it on main but the test seem to pass there, and there doesnt seem to be any real differences between the queries or the tests. |
|
|
I'll take a look tomorrow to see if I can find any explanation for why only one query is broken. |
|
I just fixed the issue — see my commit 480e3bf. Tests pass locally 😄 |
Woa, I would never have guessed that - thanks! |
aeisenberg
left a comment
There was a problem hiding this comment.
This is good enough for now. We need to determine if we are going to do anything about the -dev dependencies. This can happen later.
|
I had to manually merge in master due to some changed files, but command-line git could do it automatically without having to resolve conflicts. The extension has also been updated to use this pack. So after this gets another stamp it should finally be good to merge. |
This is a first attempt at making a separate automodel pack. This was done together with @kaeluka.
We were not super sure if this was the exact right thing to do, but it seems a starting point.
In VS code we are seeing a bunch of red lines:

However if we change the dependency to
then we still have the red lines but the queries are able to run just fine.